import static org.junit.Assert.*;

import java.io.IOException;
import java.text.ParseException;

import org.junit.Test;

public class LogicTest {
	
	
	String add1 = "add Do Homework -by 04/05/1999";
	String add2 = "add Watch Pokemon -from 03/01/1998 -to 09/03/2014";
	String add3 = "add CS2103T project V0.1 demo -from 12/03/2014 -to 12/03/2014 -label CS2103T !";
	String add4 = "add This is so random -from 03/01/1998 -to 09/03/2014 -label RandomLabel";
	String add5 = "add Task without priority -from 03/01/1998 -to 09/03/2014 ";
	String add6 = "add Complete Developer Guide Draft -by 16/03/2014 -label CS2103T";
	String add7 = "add Complete tutorial 7 for Week8 -by 11/03/2014 -label CS2103T";

	String displayEmpty = "display";
	String displayByPriority = "display !";
	String displayByLabel = "display -label CS2103T";

	String edit1 = "edit 7 Complete tutorial 1000000000000000000000000000";
	String edit2 = "edit 6 Complete Developer Guide Draft for CS2103T -by 16/03/2014 -label CS2103T";
	String edit3 = "edit 1000000000 THIS SHOULD NOT COME OUT!";

	
	public void testAdd() throws IOException, ParseException {
		Storage s = new Storage();
		History h = new History(s);
		Logic l = new Logic(s, h);

		System.out.println(l.processUserInput(add1));
		System.out.println(l.processUserInput(add2));
		System.out.println(l.processUserInput(add3));
		System.out.println(l.processUserInput(add4));
		System.out.println(l.processUserInput(add5));
	}

	
	public void testDisplay() throws IOException, ParseException {
		Storage s = new Storage();
		History h = new History(s);
		Logic l = new Logic(s, h);

		System.out.println(l.processUserInput(add1));
		System.out.println(l.processUserInput(add2));
		System.out.println(l.processUserInput(add3));
		System.out.println(l.processUserInput(add4));
		System.out.println(l.processUserInput(add5));
		System.out.println(l.processUserInput(add6));
		System.out.println(l.processUserInput(add7));
		System.out.println("Display...\n");
		System.out.println("Display Normal Mode:\n"
				+ l.processUserInput(displayEmpty));
		System.out.println();
		System.out.println("Display Priority Mode:\n"
				+ l.processUserInput(displayByPriority));
		System.out.println();
		System.out.println("Display Label Mode:\n"
				+ l.processUserInput(displayByLabel));

	}

	@Test
	public void testEdit() throws IOException, ParseException {
		Storage s = new Storage();
		History h = new History(s);
		Logic l = new Logic(s, h);

		System.out.println(l.processUserInput(add1));
		System.out.println(l.processUserInput(add2));
		System.out.println(l.processUserInput(add3));
		System.out.println(l.processUserInput(add4));
		System.out.println(l.processUserInput(add5));
		System.out.println(l.processUserInput(add6));
		System.out.println(l.processUserInput(add7));

		System.out.println("Original Task List:\n");
		System.out.println(l.processUserInput(displayEmpty));
		System.out.println("--------------------------------------");
		System.out.println("Testing Edit\n");
		System.out.println("User input: " + edit1);
		System.out.println(l.processUserInput(edit1));
		System.out.println("User input: " + edit2);
		System.out.println(l.processUserInput(edit2));
		System.out.println("User input: " + edit3);
		System.out.println(l.processUserInput(edit3));
		System.out.println("--------------------------------------");
		System.out.println("Displaying all task:\n");
		System.out.println(l.processUserInput(displayEmpty));
		System.out.println(l.processUserInput(displayByLabel));
	}

}
